app.bust = '1';
app.dynamicLoadingCss(app.resPath+'css/score_estimate/score_estimate.css?bust='+app.bust);

app.host = 'http://uc.test.gzxueersi.com/index.php/Zkgf/Admin';
if(app.isLocal){
  app.host = '/Zkgf/Admin';
}
app.getParam=function(a){var b=location.search;a=a+"=";return b.indexOf(a)==-1?'':b.substring(b.indexOf(a)+a.length,b.indexOf("&",b.indexOf(a))==-1?b.length:b.indexOf("&",b.indexOf(a)))};

layui.config({
  dir: app.libPath + 'layui/'
}).use(['jquery','layer','form'], function(){
  if(app.getParam('preview')==1){
    var $ = layui.jquery;
    $.ajax({
      url: app.host+'/getQuestion', type: 'get', xhrFields: { withCredentials: true }, crossDomain: true, dataType: 'json',
      data: {"id": app.getParam('id')},
      success: function(rst){
        if(rst){
          $("#previewQuestion").html("材料<br />" + rst.material + "题目<br />" + rst.question + "答案<br />" + rst.answer).show();
        }else{
          layer.msg("获取到的题目数据为空");
        }
      }
    });
  }else {
    app.dynamicLoadingJs(app.resPath+'js/score_estimate/score_estimate.js?bust='+app.bust);
  }
});


(function(){

      var REGX_HTML_ENCODE = /"|&|'|<|>|[\x00-\x20]|[\x7F-\xFF]|[\u0100-\u2700]/g;

      var REGX_HTML_DECODE = /&\w+;|&#(\d+);/g;

      var REGX_TRIM = /(^\s*)|(\s*$)/g;

      var HTML_DECODE = {
          "<" : "<",
          ">" : ">",
          "&" : "&",
          " ": " ",
          '"': "\"",
          "©": ""
      };

      app.encodeHtml = function(s){
          s = (s != undefined) ? s : s.toString();
          return (typeof s != "string") ? s :
              s.replace(REGX_HTML_ENCODE,
                        function($0){
                            var c = $0.charCodeAt(0), r = ["&#"];
                            c = (c == 0x20) ? 0xA0 : c;
                            r.push(c); r.push(";");
                            return r.join("");
                        });
      };

      app.decodeHtml = function(s){
          s = (s != undefined) ? s : s.toString();
          return (typeof s != "string") ? s :
              s.replace(REGX_HTML_DECODE,
                        function($0, $1){
                            var c = HTML_DECODE[$0];
                            if(c == undefined){
                                // Maybe is Entity Number
                                if(!isNaN($1)){
                                    c = String.fromCharCode(($1 == 160) ? 32:$1);
                                }else{
                                    c = $0;
                                }
                            }
                            return c;
                        });
      };

      app.trim = function(s){
          s = (s != undefined) ? s : s.toString();
          return (typeof s != "string") ? s :
              s.replace(REGX_TRIM, "");
      };
      app.html2Escape = function(sHtml) {
        return sHtml.replace(/[<>&"]/g,function(c){return {'<':'&lt;','>':'&gt;','&':'&amp;','"':'&quot;'}[c];});
      };
      app.escape2Html = function(str) {
        var arrEntities={'lt':'<','gt':'>','nbsp':' ','amp':'&','quot':'"'};
        return str.replace(/&(lt|gt|nbsp|amp|quot);/ig,function(all,t){return arrEntities[t];});
      };


})()
